<?php
/**
 *
 * 登录验证
 *
 */
namespace app\site\middleware;

use thans\jwt\exception\TokenBlacklistGracePeriodException;
use thans\jwt\exception\TokenExpiredException;
use thans\jwt\facade\JWTAuth;
use think\facade\Config;

class CheckLogin
{
    public function handle($request, \Closure $next)
    {


        // 登录验证
        try {
            JWTAuth::auth();

        } catch (\Exception $e){   // 捕获异常
            return json(['error'=>10001, 'msg'=>'令牌过期']);
        }

        return $next($request);
    }

}
